import 'package:dss_base/dss_base.dart';
import 'package:dss_base/ext/string_ext.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class NavMenuWidget extends StatelessWidget {
  const NavMenuWidget({
    super.key,
    required this.text,
    required this.icon,
    required this.num,
    required this.onTap,
  });

  final String icon;
  final String text;
  final int num;
  final GestureTapCallback? onTap;

  @override
  Widget build(BuildContext context) {
    var content = Stack(
      children: [
        Center(
          child: Column(
            children: [
              SizedBox(height: 6),

              Image.asset(icon.toAssetsImagesPath(), width: 22.w, height: 22.w),
              SizedBox(height: 2),
              Text(
                text,
                textAlign: TextAlign.center,
                style: TextStyle(color: Color(0xFF666666), fontSize: 10.sp),
              ),
              SizedBox(height: 6),
            ],
          ),
        ),
        Center(
          child: Padding(
            padding: EdgeInsets.only(left: 25.w, top: 3.w),
            child: BadgeWidget(num: num),
          ),
        ),
      ],
    );
    return Expanded(
      child: InkWell(onTap: onTap, child: content),
    );
  }
}
